Skip to content

test(jobs): drive expiry/reaper coverage to 95%#51

Merged
mastermanas805 merged 2 commits into
masterfrom
coverage/worker-jobs-expire-95
May 22, 2026
Merged

test(jobs): drive expiry/reaper coverage to 95%#51
mastermanas805 merged 2 commits into
masterfrom
coverage/worker-jobs-expire-95

Conversation

@mastermanas805
Copy link
Copy Markdown
Member

Summary

  • Drives the expiry/reaper job family in worker/internal/jobs to 95.1% aggregate statement coverage (was 87%).
  • Adds in-package tests for previously-unreachable unexported seams: deprovisionMinIOUser (madmin client vs httptest), deleteStorageObjects (empty-prefix + list/remove paths), the in-cluster ExpireStacks.Work k8s namespace teardown branch, signMagicLinkResendJWT, driveResend JWT-sign failure, and rows.Err propagation in expire_imminent/expiry_reminder.
  • expire_stacks.go: the hardcoded SA-token/CA paths + k8s API base URL become test-overridable package vars (identical prod defaults — no behavior change).

Per-file coverage

file %
expire.go 95.4%
expire_imminent.go 90.4%*
expire_stacks.go 96.9%
expiry_reminder.go 97.3%
expiry_reminder_email.go 84.0%*
pending_deletion_expirer.go 100%
magic_link_reconciler.go 95.7%
TOTAL 95.1%

*Remaining uncovered lines are genuinely unreachable defensive branches: json.Marshal of a primitive map, and template.Execute fallbacks for templates already validated by template.Must at init.

Test plan

  • go build ./... && go vet ./... clean
  • go test ./... -short -count=1 green (all packages)
  • Coverage measured via statement-weighted coverprofile parse

🤖 Generated with Claude Code

mastermanas805 and others added 2 commits May 22, 2026 07:36
Cover the anon-TTL reaper, 6/2/1h imminent + reminder cadence, stack
expiry (incl. the in-cluster k8s namespace teardown path), pending-
deletion expirer, and magic-link reconciler. Adds in-package tests for
unexported seams: deprovisionMinIOUser, deleteStorageObjects, the
in-cluster ExpireStacks Work branch, signMagicLinkResendJWT, and
rows.Err propagation. expire_stacks.go's hardcoded SA-token/CA paths +
k8s API base become test-overridable package vars (identical prod
defaults, no behavior change). Aggregate target-file coverage 87% → 95%.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The storage-object reaper incremented objectCount in the producer
goroutine and read it in the post-drain slog with no happens-before
guarantee. CI's -race build (which the new coverage tests now exercise
end-to-end) flagged it. Promote to atomic.Int64.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mastermanas805 mastermanas805 merged commit e67975e into master May 22, 2026
10 checks passed
@mastermanas805 mastermanas805 deleted the coverage/worker-jobs-expire-95 branch May 22, 2026 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant